package csrfdemo.controller;


import csrfdemo.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    private User user = new User("admin", "admin@example.com");

    @PostMapping("/updateEmail")
    public String updateEmail(@RequestParam String email) {
        user.setEmail(email);
        return "Email updated to: " + user.getEmail();
    }

    @GetMapping("/info")
    public User getUserInfo() {
        return user;
    }
}